//###############
//FILE : ServerStatus.java
//WRITER : Daniel Lowengrub, daniel_i_l, 320687098
//EXERCISE : oop ex2 2011
//DESCRIPTION:
//See below
//###############

package oop.ex3.communication;

/**
 * This stores the status of a server and allows the status to be updated
 * externally. The standard use is to have a server contain an istance of this
 * class and pass it to objects that can effect it's state.
 * @author daniel
 */
public class ServerStatus {
    private volatile boolean _running;

    /**
     * Create a new status. The running boolean is set to the default true.
     */
    public ServerStatus() {
        _running = true;
    }

    /**
     * Set the server status to stopped.
     */
    public void stopServer() {
        _running = false;
    }

    /**
     * Check the status.
     * @return True if the server is running and false otherwise.
     */
    public boolean running() {
        return _running;
    }
}
